package com.javasm.controller;


import com.javasm.common.http.AxiosResult;
import com.javasm.controller.base.BaseController;
import com.javasm.domin.vo.IndentGoodsVo;
import com.javasm.domin.vo.TotalMarketVo;
import com.javasm.service.CountGoodsService;
import com.javasm.service.IndentService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashSet;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author longjun
 * @since 2022-01-18
 */
@RestController
@RequestMapping("/countGoods")
@RequiredArgsConstructor
public class CountGoodsController extends BaseController {

    private final CountGoodsService countGoodsService;


    @GetMapping("findCountGoods/{id}")
    public AxiosResult<List<IndentGoodsVo>> findCountGoods(@PathVariable Long id) {

        List<IndentGoodsVo> indentGoodsVoList = countGoodsService.searchCountGoods(id);
        return AxiosResult.success(indentGoodsVoList);
    }

    @GetMapping("findTotalGoods")
    public AxiosResult<List<TotalMarketVo>> findCountGoods() {

        List<TotalMarketVo> totalMarketVoList = countGoodsService.searchTotalGoods();
        return AxiosResult.success(totalMarketVoList);
    }
}
